package com.cyys.modules.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Title: FilterConfig
 * @ProjectName cyys-parent
 * @Description: 特殊处理类 获取请求param参数
 * @Author lishengquan
 * @Date 2019/7/9 12:11
 * @Version 1.0
 */
@Configuration
public class FilterConfig {


    private static ThreadLocal<HttpServletRequest> requestLocal = new ThreadLocal<HttpServletRequest>();
    private static ThreadLocal<HttpServletResponse> responseLocal = new ThreadLocal<HttpServletResponse>();

    @Bean
    public static HttpServletRequest getRequest() {
        return (HttpServletRequest) requestLocal.get();
    }

    public static void SetRequest(HttpServletRequest request) {
        requestLocal.set(request);
    }

    @Bean
    public static HttpServletResponse getResponse() {
        return (HttpServletResponse) responseLocal.get();
    }

    public static void setResponse(HttpServletResponse response) {
        responseLocal.set(response);
    }
}
